/**
 * @Author: wangliuyang
 * @Date: 2021/8/16 10:42
 * @Description:55. 跳跃游戏
 */
public class Solution_55 {
    public boolean canJump(int[] nums) {
        if (nums == null || nums.length == 0){
            return true;
        }
        int mostRight = 1;
        for (int i = 0; i < mostRight; i++) {
            if (nums[i] + i >= mostRight){
                mostRight = nums[i] + i + 1;
            }
            if (mostRight >= nums.length){
                return true;
            }
        }
        return false;
    }
}
